import { requestClient } from '#/api/request';

export namespace RasterServiceApi {
  export interface ChangeColorMapDTO {
    userId: string;
    sceneId: string;
    rasterSId: string;
    band: number;
    colorMap: string;
    shade: boolean;
    shadeParams: {
      altdeg: number;
      azdeg: number;
      mode: string;
      vert_exag: number;
    };
  }

  export interface FalseColorCompositeDTO {
    userId: string;
    sceneId: string;
    rasterSId: string;
    bandList: Array<number>;
  }

  export interface GetRasterSCopyDTO {
    userId: string;
    sceneId: string;
    rasterSId: string;
  }
}
const getRasterSList = (
  userId: string,
  pageSize: number,
  currentPage: number,
  keyword: string,
) => {
  return requestClient.get(
    `/dsc-systemMS/dsc-raster-service/getRasterSList/${userId}/${pageSize}/${currentPage}?keyword=${keyword}`,
  );
};

const deleteRasterService = (userId: string, rasterId: string) => {
  return requestClient.delete(
    `/dsc-systemMS/dsc-raster-service/delete/${userId}/${rasterId}`,
  );
};

const getRasterSListByFileId = (fileId: string) => {
  return requestClient.get(
    `/dsc-systemMS/dsc-raster-service/getRasterSListByFileId/${fileId}`,
  );
};

const getBandCount = (userId: string, rasterSId: string) => {
  return requestClient.get(
    `/dsc-systemMS/dsc-tif/getBandCount/${userId}/${rasterSId}`,
  );
};

const changeColorMap = (
  changeColorMapDTO: RasterServiceApi.ChangeColorMapDTO,
) => {
  return requestClient.post(
    '/dsc-systemMS/dsc-tif/changeColorMap',
    changeColorMapDTO,
  );
};
const falseColorComposite = (
  falseColorCompositeDTO: RasterServiceApi.FalseColorCompositeDTO,
) => {
  return requestClient.post(
    '/dsc-systemMS/dsc-tif/falseColorComposite',
    falseColorCompositeDTO,
  );
};

const addRasterSCopy = (
  getRasterSCopyDTO: RasterServiceApi.GetRasterSCopyDTO,
) => {
  return requestClient.post(
    '/dsc-systemMS/dsc-raster-service/addRasterSCopy',
    getRasterSCopyDTO,
  );
};

const deleteRasterSCopy = (sceneId: string, rasterSId: string) => {
  return requestClient.delete(
    `/dsc-systemMS/dsc-raster-service/deleteRasterSCopy/${sceneId}/${rasterSId}`,
  );
};

export default {
  getRasterSList,
  deleteRasterService,
  getRasterSListByFileId,
  getBandCount,
  changeColorMap,
  falseColorComposite,
  addRasterSCopy,
  deleteRasterSCopy,
};
